#ifndef DISPLAYER_HEADER
#define DISPLAYER_HEADER

#include "OblivionPhysics.h"
#include "DisplayPrimitive.h"

#include "Camera.h"
#include "glm/glm.hpp"
#include "glm/ext.hpp"
#include <vector>

#include "Sprite.h"

//
//struct GraphicsPrimitive {
//	
//	//XXX This should encapsulate some type of memory management?
//	//Really I just want this 
//	
//
//
//	//XXX Possibly add a shader, or a shader entry?
//	//We don't want to switch shaders all the time, so perhaps add a group identifier and
//	//split up list in displayer based on common shaders?
//};
//
//struct PlayerGraphicsPrimitive : public GraphicsPrimitive {
//	PlayerGraphicsPrimitive( GameEntity * mEntity ) :
//	GraphicsPrimitive(mEntity) {}
//};
//
////XXX Sprite animation
//
//struct EffectGraphicsPrimitive {
//
//	EffectGraphicsPrimitive() : 
//		mCurrTimer(0.0f),
//		mDuration(-1) {}
//
//	bool Update( float timeStep );
//
//	//
//	float mDuration;
//	float mCurrTimer;
//};


class Displayer {
public:
	Displayer() 
		: mCam(NULL) {}
	
	Camera * GetCam() { return this->mCam; }

	void SetCamera( Camera * inCam );

	Camera * GetCamera ();

	void AddDisplayPrimitive( DisplayPrimitive * inPrim );

	void RemoveDisplayPrimitive( DisplayPrimitive * inPrim );

	DisplayPrimitive * AddFromDef( const DisplayPrimitiveDef * inDef );

	void Display();

	void SetClearColor(float r, float g, float b, float a);

	void Update( float timeStep );
	
private:

	Camera * mCam;

	void InitFrame();	
	
	void DrawDisplayList();

	int GetDisplayItem ( DisplayPrimitive * inPrim ) ;

	std::vector< DisplayPrimitive * > mDisplayList;

	glm::vec4 mClearColor;
};

#endif